﻿using System;
using System.Collections.Generic;
using EntryEngine;
using EntryEngine.Network;
using EntryEngine.Serialize;

using System.Linq;
using System.Text;
using System.Net;
interface _IUser
{
    T_USER UserInfo();
    bool UserModifyPassword(string opass, string npass);
    bool UserModifyPhone(string phone, string code);
    bool UserExitLogin();
}

class IUserStub : StubHttp
{
    public Action<HttpListenerContext, object> __AutoCallback;
    public _IUser __Agent;
    public Func<_IUser> __GetAgent;
    public Func<HttpListenerContext, _IUser> __ReadAgent;
    public IUserStub(_IUser agent)
    {
        this.__Agent = agent;
        this.Protocol = "3";
        AddMethod("UserInfo", UserInfo);
        AddMethod("UserModifyPassword", UserModifyPassword);
        AddMethod("UserModifyPhone", UserModifyPhone);
        AddMethod("UserExitLogin", UserExitLogin);
    }
    void UserInfo(HttpListenerContext __context)
    {
        var agent = __Agent;
        if (__GetAgent != null) { var temp = __GetAgent(); if (temp != null) agent = temp; }
        if (__ReadAgent != null) { var temp = __ReadAgent(__context); if (temp != null) agent = temp; }
        var __result = agent.UserInfo();
        if (__AutoCallback != null) __AutoCallback(__context, __result);
        else
        {
            string __ret = JsonWriter.Serialize(__result);
            #if DEBUG
            _LOG.Debug("UserInfo {0}", __ret);
            #endif
            this.Response(__ret);
        }
    }
    void UserModifyPassword(HttpListenerContext __context)
    {
        var agent = __Agent;
        if (__GetAgent != null) { var temp = __GetAgent(); if (temp != null) agent = temp; }
        if (__ReadAgent != null) { var temp = __ReadAgent(__context); if (temp != null) agent = temp; }
        string __temp;
        __temp = GetParam("opass");
        string opass = __temp;
        __temp = GetParam("npass");
        string npass = __temp;
        #if DEBUG
        _LOG.Debug("UserModifyPassword opass: {0}, npass: {1}", opass, npass);
        #endif
        var __result = agent.UserModifyPassword(opass, npass);
        if (__AutoCallback != null) __AutoCallback(__context, __result);
        else
        {
            string __ret = JsonWriter.Serialize(__result);
            #if DEBUG
            _LOG.Debug("UserModifyPassword {0}", __ret);
            #endif
            this.Response(__ret);
        }
    }
    void UserModifyPhone(HttpListenerContext __context)
    {
        var agent = __Agent;
        if (__GetAgent != null) { var temp = __GetAgent(); if (temp != null) agent = temp; }
        if (__ReadAgent != null) { var temp = __ReadAgent(__context); if (temp != null) agent = temp; }
        string __temp;
        __temp = GetParam("phone");
        string phone = __temp;
        __temp = GetParam("code");
        string code = __temp;
        #if DEBUG
        _LOG.Debug("UserModifyPhone phone: {0}, code: {1}", phone, code);
        #endif
        var __result = agent.UserModifyPhone(phone, code);
        if (__AutoCallback != null) __AutoCallback(__context, __result);
        else
        {
            string __ret = JsonWriter.Serialize(__result);
            #if DEBUG
            _LOG.Debug("UserModifyPhone {0}", __ret);
            #endif
            this.Response(__ret);
        }
    }
    void UserExitLogin(HttpListenerContext __context)
    {
        var agent = __Agent;
        if (__GetAgent != null) { var temp = __GetAgent(); if (temp != null) agent = temp; }
        if (__ReadAgent != null) { var temp = __ReadAgent(__context); if (temp != null) agent = temp; }
        var __result = agent.UserExitLogin();
        if (__AutoCallback != null) __AutoCallback(__context, __result);
        else
        {
            string __ret = JsonWriter.Serialize(__result);
            #if DEBUG
            _LOG.Debug("UserExitLogin {0}", __ret);
            #endif
            this.Response(__ret);
        }
    }
}
